var BookListCtrl = ['$scope', '$http', function($scope, $http) {
    $scope.orderProp = 'titles';

    $http.get('http://localhost:8080/rest/books.json').success(function(data) {
        $.each(data.books, function(index,book){
            if( book.purchaseDate===null ){
                book.purchaseDate = "onbekend"
            } else  {
                book.purchaseDate = moment.unix((book.purchaseDate/1000)).format("DD-MM-YYYY");
            }
        });

        $scope.books = data.books;
    });
}];